﻿using System;
using System.Windows.Input;

namespace HobSoft.SoccerBet2014.Client.Configuration
{
    using Domain.Implementation;

    public class BettingKeyRepository : ReadWriteBinaryRepository<BettingKeySetting, string>
    {
        public const string BET_MONEY1 = "BetMoney1";
        public const string BET_MONEY2 = "BetMoney2";
        public const string BET_MONEY3 = "BetMoney3";
        public const string BET_MONEY4 = "BetMoney4";
        public const string BET_MONEY5 = "BetMoney5";
        public const string BET_MONEY6 = "BetMoney6";
        public const string BET_MONEY7 = "BetMoney7";
        public const string BET_MONEY8 = "BetMoney8";
        public const string BET_MONEY9 = "BetMoney9";
        public const string FOCUS1 = "Focus1";
        public const string FOCUS2 = "Focus2";
        public const string FOCUS3 = "Focus3";

        protected override Func<BettingKeySetting, string> FindKey
        {
            get { return bk => bk.Name; }
        }

        public void RegisterDefault()
        {
            if (!BinModels.ContainsKey(BET_MONEY1))
            {
                var bks = new BettingKeySetting(BET_MONEY1, Key.D1, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY1, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY2))
            {
                var bks = new BettingKeySetting(BET_MONEY2, Key.D2, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY2, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY3))
            {
                var bks = new BettingKeySetting(BET_MONEY3, Key.D3, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY3, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY4))
            {
                var bks = new BettingKeySetting(BET_MONEY4, Key.D4, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY4, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY5))
            {
                var bks = new BettingKeySetting(BET_MONEY5, Key.D5, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY5, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY6))
            {
                var bks = new BettingKeySetting(BET_MONEY6, Key.D6, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY6, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY7))
            {
                var bks = new BettingKeySetting(BET_MONEY7, Key.D7, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY7, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY8))
            {
                var bks = new BettingKeySetting(BET_MONEY8, Key.D8, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY8, bks);
            }
            if (!BinModels.ContainsKey(BET_MONEY9))
            {
                var bks = new BettingKeySetting(BET_MONEY9, Key.D9, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Betting;
                BinModels.TryAdd(BET_MONEY9, bks);
            }
            if (!BinModels.ContainsKey(FOCUS1))
            {
                var bks = new BettingKeySetting(FOCUS1, Key.F1, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Focus;
                BinModels.TryAdd(FOCUS1, bks);
            }
            if (!BinModels.ContainsKey(FOCUS2))
            {
                var bks = new BettingKeySetting(FOCUS2, Key.F2, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Focus;
                BinModels.TryAdd(FOCUS2, bks);
            }
            if (!BinModels.ContainsKey(FOCUS3))
            {
                var bks = new BettingKeySetting(FOCUS3, Key.F3, ModifierKeys.None);
                bks.HotKeyCommand = HotKeyCommand.Focus;
                BinModels.TryAdd(FOCUS3, bks);
            }
        }
    }
}
